# __*__coding:utf-8__*__
# author: happyGoat0809
import tkinter as tk
import tkinter.messagebox
import setQr

window = tk.Tk()  # 建立窗口
window.title('生成二维码小软件2.0')  # 窗口标题
window.geometry('500x300')  # 窗口大小

# 设计标签
l = tk.Label(window, text='输入文本生成二维码(最多100字)', font=('Arial', 12), width=30, height=2)
#  放置标签
l.pack()
# 设置输入框
e = tk.Text(window, height=4)
e.pack()


#  生成二维码函数
def qr():
    try:
        text = e.get('1.0', '100.0')
        setQr.setQrcode(text)
    except:
        tkinter.messagebox.showinfo('错误', '生成失败!!!')
    else:
        tkinter.messagebox.showinfo('提示', '生成成功!!!')


# 按钮设置
b = tk.Button(window, text='点我生成', width=10, height=2, command=qr)
b.pack()

# 循坏显示
window.mainloop()
